/*
 * ITag.h
 *
 *  Created on: 18 juin 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#ifndef ITAG_H_
#define ITAG_H_

#include <string>
#include <istream>
#include <ostream>

namespace NamedBinaryTag
{

enum TagTypes
{
	TAG_END,
	TAG_BYTE,
	TAG_SHORT,
	TAG_INT,
	TAG_LONG,
	TAG_FLOAT,
	TAG_DOUBLE,
	TAG_BYTEARRAY,
	TAG_STRING,
	TAG_LIST,
	TAG_COMPOUND
};

class __attribute__((visibility("default"))) ITag
{
protected:
	void *root;
	ITag();
	ITag(void *root);
public:
	virtual ~ITag();
	virtual TagTypes get_TagType() const = 0;
	virtual std::string get_Name() const = 0;
	virtual void set_Name(std::string value) = 0;

	virtual void Read(std::istream &input) = 0;
	virtual void Write(std::ostream &output) const = 0;

	virtual ITag *clone() const = 0;
	friend class DataFile;
	friend class TagCompound;
	friend class TagList;
protected:
	virtual ITag *clone(void *newRoot) const = 0;
};

}

#endif /* ITAG_H_ */
